const express = require('express')
const app = express()

// 允许跨域
app.use((req, res, next) => {
  res.header('Access-Control-Allow-Origin', '*')
  next()
})

app.get('/api/data', (req, res) => {
  res.json({ message: '来自后端的数据！！！' })
})

app.listen(3000, () => {
  console.log('后端运行在 http://localhost:3000')
})